package com.wn32.main.price;

import java.util.Properties;

public class MyFactory {
    public static PriceService getBean(){
        Properties p = new Properties();
        try {
            p.load(MyFactory.class.getResourceAsStream("set.properties"));
            String type = p.getProperty("type");
            if(type.equals("com.wn32.main.price.PriceServcieImpl2020")){
                return new PriceServcieImpl2020();
            }else if(type.equals("com.wn32.main.price.PriceServcieImpl2021")){
                return new PriceServiceImpl2021();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
